import fetch from 'common/src/utils/fetch'

/**
 * 添加公共选修课分类
 */
export function addcoursesCategory(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategory',
        method: 'post',
        data
    });
}

export function coursesCategoryList(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategory/list',
        method: 'POST',
        data    
    });
}
export function deleteCoursesCategory(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategory',
        method: 'DELETE',
        data
    });
}
export function updateCoursesCategory(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategory',
        method: 'PUT',
        data
    });
}
export function getCoursesCategoryById(id) {
    return fetch({
        url: '/api/cultureservice/coursesCategory/'+id,
        method: 'GET'
    });
}
/**
 * 增加公选课下的课程类别
 * @param {*} data 
 */
export function addChildCoursesCategory(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategoryLabel/',
        method: 'POST',
        data
    });
}
/**
 * 查询公选课分类下课程分类列表
 * @param {*} data 
 */
export function getChildCoursesCategories(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategoryLabel/list',
        method: 'POST',
        data
    });
}
/**
 * 删除公选课分类下课程分类
 * @param {*} data 
 */
export function deleteChildCoursesCategories(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategoryLabel',
        method: 'DELETE',
        data
    });
}
/**
 * 根据id查询公共选修课下课程分类详情
 * @param {*} id 
 */
export function getChildCoursesCategoryById(id) {
    return fetch({
        url: '/api/cultureservice/coursesCategoryLabel/'+id,
        method: 'GET'
    });
}
/**
 * 编辑公选课下的课程类别
 * @param {*} data 
 */
export function editChildCoursesCategory(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategoryLabel',
        method: 'PUT',
        data
    });
}
/**
 * 查询所有为叶子节点的课程分类
 */
export function getChildrenNodeCoursesCategory() {
    return fetch({
        url: '/api/cultureservice/coursesLabel/sonList',
        method: 'GET'
    });
}


/**
 * 查询课程列表
 */
export function getCourses(data) {
    return fetch({
        url: '/api/cultureservice/courses/page',
        method: 'POST',
        data
    });
}

/**
 * 增加公选课分类或分级课程分类下课程(包含批量)
 */
export function addCourses(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategoryRel',
        method: 'POST',
        data
    });
}
/**
 * 根据条件，分页(不分页)查询公选课，分级课程
 */
export function getCoursesByCondition(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategoryRel/list',
        method: 'POST',
        data
    });
}
/**
 * 删除公选课或分级课程分类下课程（包含批量删除）
 */
export function deleteCourses(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategoryRel',
        method: 'DELETE',
        data
    });
}
/**
 * 根据id查询公选课或分级课程分类下课程详情
 */
export function getCourseInfoById(id) {
    return fetch({
        url: '/api/cultureservice/coursesCategoryRel/'+id,
        method: 'GET',
    });
}
/**
 * 编辑公选课或分级课程分类下课程
 */
export function EditCourse(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategoryRel',
        method: 'PUT',
        data
    });
}
/**
 * 批量保存标签
 */
export function batchSaveTags(data) {
    return fetch({
        url: '/api/cultureservice/coursesCategoryRel/Label',
        method: 'PUT',
        data
    });
}